package com.infocollect.project.grant.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.infocollect.framework.aspectj.lang.annotation.Log;
import com.infocollect.framework.aspectj.lang.enums.BusinessType;
import com.infocollect.project.grant.domain.GrExaminerBankcard;
import com.infocollect.project.grant.service.IGrExaminerBankcardService;
import com.infocollect.framework.web.controller.BaseController;
import com.infocollect.framework.web.domain.AjaxResult;
import com.infocollect.common.utils.poi.ExcelUtil;
import com.infocollect.framework.web.page.TableDataInfo;

/**
 * 银行卡信息Controller
 * 
 * @author infocollect
 * @date 2022-05-14
 */
@RestController
@RequestMapping("/grant/examinerbankcard")
public class GrExaminerBankcardController extends BaseController
{
    @Autowired
    private IGrExaminerBankcardService grExaminerBankcardService;

    /**
     * 查询银行卡信息列表
     */
    @PreAuthorize("@ss.hasPermi('grant:examinerbankcard:list')")
    @GetMapping("/list")
    public TableDataInfo list(GrExaminerBankcard grExaminerBankcard)
    {
        startPage();
        List<GrExaminerBankcard> list = grExaminerBankcardService.selectGrExaminerBankcardList(grExaminerBankcard);
        return getDataTable(list);
    }

    /**
     * 导出银行卡信息列表
     */
    @PreAuthorize("@ss.hasPermi('grant:examinerbankcard:export')")
    @Log(title = "银行卡信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(GrExaminerBankcard grExaminerBankcard)
    {
        List<GrExaminerBankcard> list = grExaminerBankcardService.selectGrExaminerBankcardList(grExaminerBankcard);
        ExcelUtil<GrExaminerBankcard> util = new ExcelUtil<GrExaminerBankcard>(GrExaminerBankcard.class);
        return util.exportExcel(list, "examinerbankcard");
    }

    /**
     * 获取银行卡信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('grant:examinerbankcard:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(grExaminerBankcardService.selectGrExaminerBankcardById(id));
    }

    /**
     * 新增银行卡信息
     */
    @PreAuthorize("@ss.hasPermi('grant:examinerbankcard:add')")
    @Log(title = "银行卡信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GrExaminerBankcard grExaminerBankcard)
    {
        return toAjax(grExaminerBankcardService.insertGrExaminerBankcard(grExaminerBankcard));
    }

    /**
     * 修改银行卡信息
     */
    @PreAuthorize("@ss.hasPermi('grant:examinerbankcard:edit')")
    @Log(title = "银行卡信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GrExaminerBankcard grExaminerBankcard)
    {
        return toAjax(grExaminerBankcardService.updateGrExaminerBankcard(grExaminerBankcard));
    }

    /**
     * 删除银行卡信息
     */
    @PreAuthorize("@ss.hasPermi('grant:examinerbankcard:remove')")
    @Log(title = "银行卡信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(grExaminerBankcardService.deleteGrExaminerBankcardByIds(ids));
    }
}
